{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a4d15657",
   "metadata": {},
   "outputs": [],
   "source": [
    "found = []"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "dc6fd533",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(found)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "b11a171c",
   "metadata": {},
   "outputs": [],
   "source": [
    "found.append('a')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "976c4e18",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(found)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "a213890f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['a']"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "found"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "7518b436",
   "metadata": {},
   "outputs": [],
   "source": [
    "found.append('e')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "cdbc6df8",
   "metadata": {},
   "outputs": [],
   "source": [
    "found.append('i')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "b2f6f7ba",
   "metadata": {},
   "outputs": [],
   "source": [
    "found.append('o')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "addadcec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(found)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "3eb8f3d0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['a', 'a', 'e', 'i', 'o']"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "found"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "3f7b9aef",
   "metadata": {},
   "outputs": [],
   "source": [
    "if 'u' not in found:\n",
    "    found.append('u')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "6f08a732",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['a', 'a', 'e', 'i', 'o', 'u']"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "found"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "f12c02bf",
   "metadata": {},
   "outputs": [],
   "source": [
    "if 'u' not in found:\n",
    "    found.append('u')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "74342093",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['a', 'a', 'e', 'i', 'o', 'u']"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "found"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "e52135f3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "i\n",
      "i\n",
      "a\n"
     ]
    }
   ],
   "source": [
    "vowels = ['a','e','i','o','u']\n",
    "word = \"Milliways\"\n",
    "for letter in word:\n",
    "    if letter in vowels:\n",
    "        print(letter)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "3c04ddf8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "i\n",
      "a\n"
     ]
    }
   ],
   "source": [
    "vowels = ['a','e','i','o','u']\n",
    "word = \"Milliways\"\n",
    "found = []\n",
    "for letter in word:\n",
    "    if letter in vowels:\n",
    "        if letter not in found:\n",
    "            found.append(letter)\n",
    "for vowel in found:\n",
    "    print(vowel)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "f4c8e4a9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Provide a word to search for vowels:milliways\n",
      "i\n",
      "a\n"
     ]
    }
   ],
   "source": [
    "vowels = ['a','e','i','o','u']\n",
    "word = input(\"Provide a word to search for vowels:\")\n",
    "found = []\n",
    "for letter in word:\n",
    "    if letter in vowels:\n",
    "        if letter not in found:\n",
    "            found.append(letter)\n",
    "for vowel in found:\n",
    "    print(vowel)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "0d0909f5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Don't panic!\n",
      "['D', 'o', 'n', \"'\", 't', ' ', 'p', 'a', 'n', 'i', 'c', '!']\n"
     ]
    },
    {
     "ename": "ValueError",
     "evalue": "list.remove(x): x not in list",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "Input \u001b[1;32mIn [22]\u001b[0m, in \u001b[0;36m<cell line: 8>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      6\u001b[0m     plist\u001b[38;5;241m.\u001b[39mpop()\n\u001b[0;32m      7\u001b[0m plist\u001b[38;5;241m.\u001b[39mpop(\u001b[38;5;241m0\u001b[39m)\n\u001b[1;32m----> 8\u001b[0m \u001b[43mplist\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mremove\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m \u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[0;32m      9\u001b[0m plist\u001b[38;5;241m.\u001b[39mextend([plist\u001b[38;5;241m.\u001b[39mpop(),plist\u001b[38;5;241m.\u001b[39mpop()])\n\u001b[0;32m     10\u001b[0m plist\u001b[38;5;241m.\u001b[39minsert(\u001b[38;5;241m2\u001b[39m,plist\u001b[38;5;241m.\u001b[39mpop(\u001b[38;5;241m3\u001b[39m))\n",
      "\u001b[1;31mValueError\u001b[0m: list.remove(x): x not in list"
     ]
    }
   ],
   "source": [
    "phrase = \"Don't panic!\"\n",
    "plist = list(phrase)\n",
    "print(phrase)\n",
    "print(plist)\n",
    "for i in range(4):\n",
    "    plist.pop()\n",
    "plist.pop(0)\n",
    "plist.remove(\" '\")\n",
    "plist.extend([plist.pop(),plist.pop()])\n",
    "plist.insert(2,plist.pop(3))\n",
    "new_phrase = ''.join(plist)\n",
    "print(plist)\n",
    "print(new_phrase)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "ea456873",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Don't panic\n",
      "['D', 'o', 'n', \"'\", 't', ' ', 'p', 'a', 'n', 'i', 'c']\n",
      "['D', 'o', 'n', \"'\", 't', ' ', 'p', 'a', 'n', 'i', 'c']\n",
      "on tap\n"
     ]
    }
   ],
   "source": [
    "phrase = \"Don't panic\"\n",
    "plist = list(phrase)\n",
    "print(phrase)\n",
    "print(plist)\n",
    "new_phrase = ''.join(plist[1:3])\n",
    "new_phrase = new_phrase + ''.join([plist[5],plist[4],plist[7],plist[6]])\n",
    "print(plist)\n",
    "print(new_phrase)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "dd7f3f32",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t, char\n",
      "\t, char\n",
      "\t, char\n",
      "\t, char\n",
      "\t, char\n",
      "\t, char\n"
     ]
    }
   ],
   "source": [
    "paranoid_android = \"Marvin\"\n",
    "letters = list(paranoid_android)\n",
    "for char in letters:\n",
    "    print('\\t, char')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "ed8d9afa",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t M\n",
      "\t a\n",
      "\t r\n",
      "\t v\n",
      "\t i\n",
      "\t n\n",
      "\n",
      "\t\t A\n",
      "\t\t n\n",
      "\t\t d\n",
      "\t\t r\n",
      "\t\t o\n",
      "\t\t i\n",
      "\t\t d\n",
      "\n",
      "\t\t\t a\n",
      "\t\t\t r\n",
      "\t\t\t a\n",
      "\t\t\t n\n",
      "\t\t\t o\n",
      "\t\t\t i\n",
      "\t\t\t d\n",
      "\t\t\t  \n"
     ]
    }
   ],
   "source": [
    "paranoid_android = \"Marvin,the Paranoid Android\"\n",
    "letters = list(paranoid_android)\n",
    "for char in letters[:6]:\n",
    "    print('\\t', char)\n",
    "print()\n",
    "for char in letters[-7:]:\n",
    "    print('\\t'*2, char)\n",
    "print()\n",
    "for char in letters[12:20]:\n",
    "    print('\\t'*3, char)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8ad5161d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
